var do_App = sm("do_App");
var do_Page = sm("do_Page");
var nf = sm("do_Notification");
var hashdata = mm("do_HashData");
var userUrl = require("url/user");
var qqHttp = require("helper/http");
var helperOpen = require("helper/open");

// 本页面-ajax业务请求url
var httpUrl = userUrl.url.suggest.detail;

// UI
var headerAout = ui("headerAout");
var aLayoutRoot = ui("aLayoutRoot");
var addheader = headerAout.add("header", "source://view/reuse/header.ui", 0, 0);
var header = ui("header");
var do_GridView_1=ui("do_GridView_1");
var do_GridView_2=ui("do_GridView_2");
// andriod返回键
do_Page.on("back", function() {
	do_App.closePage();
});
// 左上角-返回
var headerLeft = ui(addheader + ".headerLeft");

headerLeft.on("touch", function() {
	do_App.closePage()
});
header.bindData(hashdata);
hashdata.addData({
	"labelTitle" : "问题与建议",
})
header.refreshData();
// 页面装载完成后，开始初始化工作
var id;
do_Page.on("loaded", function() {
	id=do_Page.getData().id;
	loadPage();
});
//图片浏览注册事件
do_GridView_1.on("touch", function(data){
	helperOpen.open("source://view/reuse/imgBrowser.ui", {
		imgDatas :do_GridView_1.tag,index:data
	});
})
//图片浏览注册事件
do_GridView_2.on("touch", function(data){
	helperOpen.open("source://view/reuse/imgBrowser.ui", {
		imgDatas :do_GridView_2.tag,index:data
	});
})
function loadPage(){
	var params = {id : id};
		qqHttp.post(httpUrl, params, function(data) {
			ui("do_Label_content").text=data.detailVo.content;
			do_GridView_1.visible=data.detailVo.hasImg;
			do_GridView_1.items=data.detailVo.imgItems;
			do_GridView_1.tag=data.detailVo.bigImgItems;
			if(data.detailVo.isReply==1){
				ui("do_ALayout_3").visible=true;
				ui("do_LinearLayout_3").visible=true;
				ui("do_Label_reply").text=data.replyDetail.content;
				do_GridView_2.visible=data.replyDetail.hasImg;
				do_GridView_2.items=data.replyDetail.imgItems;
				do_GridView_2.tag=data.replyDetail.bigImgItems;
			}else{
				ui("do_LinearLayout_3").visible=false;
				ui("do_ALayout_3").visible=false;
			}
		})
}
